/*
 * bsp_aes.h
 *
 *  Created on: 2023年7月24日
 *      Author: fjx
 */

#ifndef SECURITY_BSP_AES_H_
#define SECURITY_BSP_AES_H_

#include "psa/crypto.h"

#define AES_KEY_ID                                 0x7fffffff

typedef enum {
  DS_AES_STATUS_SUCCESS = 0,
  DS_AES_STATUS_FAIL = -1,
  DS_AES_STATUS_ERROR_NOT_SUPPORTED = -2,
  DS_AES_STATUS_KEY_FULL = -3,

}DS_AES_STATUS;

psa_key_id_t DS_aes_get_key_id (void);
void DS_aes_destroy_keyid (uint32_t _key_id);


DS_AES_STATUS DS_aes_init (uint8_t *key, size_t key_len );

DS_AES_STATUS DS_aes_use_keyid_ae(psa_key_id_t keyid,
                           const uint8_t *plaintext,
                           size_t plaintext_length,
                           uint8_t *ciphertext,
                           size_t ciphertext_size,
                           size_t *ciphertext_length );
DS_AES_STATUS DS_aes_use_keyid_de(psa_key_id_t keyid,
                           uint8_t *ciphertext,
                           size_t ciphertext_size,
                           uint8_t *plaintext,
                           size_t plaintext_length,
                           size_t *ciphertext_length );



void ecb_test (void);

#endif /* SECURITY_DS_AES_H_ */
